// 业务组件
import SingleSelect from '@/components/Materials/SelectCom/SingleSelect.vue'
import { markRaw } from 'vue'
import { v4 as uuidv4 } from 'uuid'
import TitleEditor from '@/components/EditItems/TitleEditor.vue'
import DescEditor from '@/components/EditItems/DescEditor.vue'
import PositionEditor from '@/components/EditItems/PositionEditor.vue'
import SizeEditor from '@/components/EditItems/SizeEditor.vue'
import WeightEditor from '@/components/EditItems/WeightEditor.vue'
import ItalicEditor from '@/components/EditItems/ItalicEditor.vue'
import ColorEditor from '@/components/EditItems/ColorEditor.vue'
import { EditorType, MaterialComType } from '@/constants'
import type { EditorComps } from '@/types'
import OptionsEditor from '@/components/EditItems/OptionsEditor.vue'
import RateEditor from '@/components/EditItems/RateEditor.vue'
export default function (): EditorComps {
  return {
    id: uuidv4(),
    //类型
    type: markRaw(SingleSelect),
    name: MaterialComType.TextInput,
    // 维护组件的状态 以此来影响组件
    status: {
      // 标题编辑器
      [EditorType.title]: {
        id: uuidv4(),
        status: '默认评价/打分题目标题',
        isShow: true,
        name: 'title-edit',
        editCom: markRaw(TitleEditor),
      },
      // 详情编辑器
      [EditorType.desc]: {
        id: uuidv4(),
        status: '默认评价/打分题目描述内容',
        isShow: true,
        name: 'desc-editor',
        editCom: markRaw(DescEditor),
      },
      [EditorType.options]: {
        id: uuidv4(),
        status: ['非常不满意', '不满意', '一般', '满意', '非常满意'],
        // 当前选中的选项
        currentStatus: 0,
        isUse: false,
        isShow: true,
        name: 'options-editor',
        editCom: markRaw(RateEditor),
      },
      // 位置
      [EditorType.position]: {
        id: uuidv4(),
        status: ['左对齐', '居中对齐'],
        currentStatus: 0,
        isShow: true,
        name: 'position-editor',
        editCom: markRaw(PositionEditor),
      },
      // 标题大小
      [EditorType.titleSize]: {
        id: uuidv4(),
        status: ['22', '20', '18'],
        currentStatus: 0,
        isShow: true,
        name: 'size-editor',
        editCom: markRaw(SizeEditor),
      },
      [EditorType.descSize]: {
        id: uuidv4(),
        currentStatus: 0,
        status: ['16', '14', '12'],
        isShow: true,
        name: 'size-editor',
        editCom: markRaw(SizeEditor),
      },
      [EditorType.titleWeight]: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['加粗', '正常'],
        isShow: true,
        name: 'weight-editor',
        editCom: markRaw(WeightEditor),
      },
      [EditorType.descWeight]: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['加粗', '正常'],
        isShow: true,
        name: 'weight-editor',
        editCom: markRaw(WeightEditor),
      },
      [EditorType.titleItalic]: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['斜体', '正常'],
        isShow: true,
        name: 'italic-editor',
        editCom: markRaw(ItalicEditor),
      },
      [EditorType.descItalic]: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['斜体', '正常'],
        isShow: true,
        name: 'italic-editor',
        editCom: markRaw(ItalicEditor),
      },
      [EditorType.titleColor]: {
        id: uuidv4(),
        status: '#000',
        isShow: true,
        name: 'color-editor',
        editCom: markRaw(ColorEditor),
      },
      [EditorType.descColor]: {
        id: uuidv4(),
        status: '#909399',
        isShow: true,
        name: 'color-editor',
        editCom: markRaw(ColorEditor),
      },
    },
  }
}
